<template>
  <view :style="themeColor">
    <view class="page">
      <!--      <view class="flex benben-position-layout flex flex-wrap align-center yaoqinghaoyou_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub yaoqinghaoyou_fd0_0'>
          <view class='flex flex-wrap align-center yaoqinghaoyou_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  yaoqinghaoyou_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='yaoqinghaoyou_fd0_0_c1_c0'>分享平台</text>
          </view>
          <view class='flex flex-wrap align-center justify-end yaoqinghaoyou_fd0_0_c0'>
          </view>
        </view>

      </view> -->
      <!-- <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view> -->
      <!---分享flex布局开始-->
      <view class='flex flex-wrap align-center yaoqinghaoyou_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
        data-url="1">
        <text class='fu-iconfont2  yaoqinghaoyou_fd0_0_c0_c0'>&#xE794;</text>
      </view>
      <view class="flex flex-direction flex-wrap align-center benben-flex-layout yaoqinghaoyou_flex_1">
        <image class='yaoqinghaoyou_fd1_0' mode="aspectFill" :src='info.avatar'></image>
        <text class='yaoqinghaoyou_fd1_1'>{{info.nickname}}</text>
        <view class='flex flex-wrap align-center yaoqinghaoyou_fd1_2'>
          <image class='yaoqinghaoyou_fd1_2_c0' mode="aspectFill" :src='info.qrcode'></image>
        </view>
        <button class='yaoqinghaoyou_fd1_3' @click.stop="popupShow1710394681413=true">一键分享</button>
        <button class='yaoqinghaoyou_fd1_4' @click.stop="saveImage">保存图片</button>
      </view>

      <!---分享flex布局结束-->
      <benben-popup v-model="popupShow1710394681413" :mask="true" :mask-close-able="true" mode='bottom'>
        <!---分享flex布局开始-->
        <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout yaoqinghaoyou_flex_2">
          <view class='flex flex-wrap align-center justify-center yaoqinghaoyou_fd2_0'>
            <text class='yaoqinghaoyou_fd2_0_c0'>分享至</text>
          </view>
          <view class='flex flex-wrap align-center justify-between yaoqinghaoyou_fd2_1'>
            <view class='flex flex-direction flex-wrap align-center' @click.stop="shareApp('1')">
              <image class='yaoqinghaoyou_fd2_1_c0_c0' mode="aspectFit" :src='STATIC_URL+"171.png"'></image>
              <text class='yaoqinghaoyou_fd2_1_c0_c1'>微信好友</text>
            </view>
            <view class='flex flex-direction flex-wrap align-center' @click.stop="shareApp('2')">
              <image class='yaoqinghaoyou_fd2_1_c0_c0' mode="aspectFit" :src='STATIC_URL+"172.png"'></image>
              <text class='yaoqinghaoyou_fd2_1_c0_c1'>朋友圈</text>
            </view>
          </view>
          <image class='yaoqinghaoyou_fd2_2' mode="aspectFit" :src='STATIC_URL+"173.png"'
            @tap.stop="popupShow1710394681413=false"></image>
        </view>

        <!---分享flex布局结束-->

      </benben-popup>


    </view>
  </view>
</template>
<script>
  export default {
    components: {},


    data() {
      return {
        "popupShow1710394681413": false,
        info: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.getData()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      shareApp(id) {
        let provider = ''
        let scene = ''
        if (id == 1) {
          provider = 'weixin'
          scene = 'WXSceneSession'
        } else if (id == 2) {
          provider = 'weixin'
          scene = 'WXSenceTimeline'
        }
        uni.share({
          provider: provider,
          scene: scene,
          imageUrl: '/static/logo.png',
          title: "邀请好友",
          href: this.user.href,
          success: function(res) {
            console.log('22222')
            uni.showToast({
              title: '分享成功',
              icon: 'none'
            })
            console.log("success:" + JSON.stringify(res));
          },
          fail: function(err) {
            this.$message.info('分享失败')
            console.log("fail:" + JSON.stringify(err));
          }
        });
      },
      saveImage() {
        let that = this
        uni.showModal({
          title: "提示",
          content: "需要您的同意，才能访问手机相册权限，如若不允许将无法使用此功能",
          cancelText: '拒绝',
          confirmText: '允许',
          success(result) {
            if (result.confirm) {
              uni.downloadFile({
                url: that.info.qrcode,
                success: res => {
                  uni.saveImageToPhotosAlbum({
                    filePath: res.tempFilePath,
                    success() {
                      uni.showToast({
                        title: '保存成功',
                        icon: 'none'
                      })
                    },
                    fail() {
                      uni.showToast({
                        title: '保存失败',
                        icon: 'none'
                      })
                    }
                  })
                }
              })
            } else if (result.cancel) {
              console.log('用户点击取消');
            }

          }
        })
      },
      getData() {
        this.$api.post(global.apiUrls.post5c78c4772da97).then(res => {
          if (res.data.code == 1) {
            this.info = res.data.data
          }
        })
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background-size: 100% 100%;
  }

  .yaoqinghaoyou_flex_0 {
    background: url(image-path('145.png')) no-repeat;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .yaoqinghaoyou_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .yaoqinghaoyou_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .yaoqinghaoyou_fd0_0_c0 {
    width: 120rpx;
    position: absolute;
    top: 88rpx;
    left: 32rpx;
  }

  .yaoqinghaoyou_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .yaoqinghaoyou_flex_1 {
    background: url(image-path('145.png')) no-repeat;
    background-size: 100% 100% !important;
    padding: 350rpx 0rpx 0rpx 0rpx;
    height: 100vh;
  }

  .yaoqinghaoyou_fd1_4 {
    border: 1px solid var(--benbenbdColor2);
    background: var(--benbenbgColor1);
    border-radius: 44rpx;
    width: 480rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    color: rgba(89, 124, 240, 1);
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .yaoqinghaoyou_fd1_3 {
    border: 1px solid var(--benbenbdColor2);
    background: var(--benbenbgColor2);
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    font-size: 32rpx;
    color: #fff;
    margin: 32rpx 0rpx 0rpx 0rpx;
    width: 480rpx;
    height: 88rpx;
    line-height: 88rpx;
  }

  .yaoqinghaoyou_fd1_2_c0 {
    width: 388rpx;
    height: 388rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .yaoqinghaoyou_fd1_2 {
    margin: 32rpx 0rpx 0rpx 0rpx;
  }

  .yaoqinghaoyou_fd1_1 {
    color: #4B5269;
    font-size: 36rpx;
    font-weight: 700;
    line-height: 56rpx;
    margin: 12rpx 0rpx 0rpx 0rpx;
  }

  .yaoqinghaoyou_fd1_0 {
    border: 2px solid rgba(224, 43, 30, 1);
    width: 80rpx;
    height: 80rpx;
    margin-top: 32rpx;
    border-radius: 100rpx 100rpx 100rpx 100rpx;
  }

  .yaoqinghaoyou_flex_2 {
    background: #fff;
    background-size: 100% auto !important;
    border-radius: 40rpx 40rpx 0rpx 0rpx;
    padding: 0rpx 32rpx 66rpx 32rpx;
    position: relative;
  }

  .yaoqinghaoyou_fd2_2 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    position: absolute;
    top: 32rpx;
    right: 32rpx;
  }

  .yaoqinghaoyou_fd2_1_c0_c1 {
    line-height: 46rpx;
    font-size: 24rpx;
    font-weight: 400;
    color: #333333;
  }

  .yaoqinghaoyou_fd2_1_c0_c0 {
    width: 80rpx;
    height: 80rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 0rpx 16rpx 0rpx;
  }

  .yaoqinghaoyou_fd2_1 {
    padding: 0rpx 106rpx 0rpx 106rpx;
  }

  .yaoqinghaoyou_fd2_0_c0 {
    line-height: 46rpx;
    font-size: 32rpx;
    font-weight: 400;
    color: #333333;
    margin: 0rpx 20rpx 0rpx 20rpx;
  }

  .yaoqinghaoyou_fd2_0 {
    border-bottom: 1px solid #eee;
    margin: 0rpx 0rpx 40rpx 0rpx;
    padding: 32rpx 0rpx 32rpx 0rpx;
  }
</style>
